package com.liuhouse1.service.impl;

import com.liuhouse1.model.Student;
import com.liuhouse1.service.StudentService;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * 使用dubbo中的注解暴露服务
 * @DubboService  这是 Dubbo中的注解 把当前的服务 交给dubbo IOC进行管理,加载的时候放入到dubbo的容器中
 * 和 @Component组件是一样的 只不过@Component是属于spring的注解 放入到springIOC容器中
 */
@DubboService(interfaceClass = StudentService.class , version = "1.0" , timeout = 5000)
public class StudentServiceImpl implements StudentService {
    @Override
    public Student queryStudent(Integer id) {
        Student student = new Student();
        if(1001 == id){
            student.setId(1001);
            student.setName("1001-张三");
            student.setAge(20);
        }else if(1002 == id){
            student.setId(1002);
            student.setName("1002-李四");
            student.setAge(22);
        }
        return student;
    }
}
